export default {
  title: '热搜词管理',
  type: 'table',
  permission: '/system/search-term/list',
  config: {
    dataUrl: '/system/search-term/list',
    filter: {
      controls: [
        {
          key: 'createdDate',
          label: '创建时间',
          type: 'dateRange',
        },
        {
          key: 'contentContains',
          label: '名称',
          type: 'text'
        },
        {
          key: 'isHotIs',
          label: '是否热门',
          type: 'select',
          config: {
            options: [
              {
                text: '是',
                value: true
              },
              {
                text: '否',
                value: false
              }
            ]
          }
        },
        {
          key: 'portTypeIs',
          label: '端口类型',
          type: 'select',
          config: {
            options: [
              {
                text: '用户端',
                value: 'USER'
              },
              // {
              //   text: '企业端',
              //   value: 'ENTERPRISE'
              // }
            ]
          }
        },
        {
          key: 'positionIs',
          label: '位置',
          type: 'select',
          config: {
            options: [
              {
                text: '首页',
                value: 'HOME_PAGE'
              }
            ]
          }
        },
        {
          key: 'isTopIs',
          label: '是否置顶',
          type: 'select',
          config: {
            options: [
              {
                text: '是',
                value: true
              },
              {
                text: '否',
                value: false
              }
            ]
          }
        },
      ]
    },

    columns: [
      {
        key: 'createdDate',
        title: '创建时间',
        type: 'datetime',
        sorter: true,
        defaultSortOrder: 'descend'
      },
      {
        key: 'content',
        title: '词条内容'
      },
      {
        key: 'isHot',
        title: '是否热门',
        type: 'enum',
        config: {
          constants: {
            true: {
              text: '是',
              color: 'green'
            },
            false: {
              text: '否',
              color: 'blue'
            }
          }
        }
      },
      {
        key: 'isTop',
        title: '是否置顶',
        type: 'enum',
        config: {
          constants: {
            true: {
              text: '是',
              color: 'green'
            },
            false: {
              text: '否',
              color: 'blue'
            }
          }
        }
      },
      {
        key: 'portType',
        title: '端口类型',
        type: 'enum',
        config: {
          constants: {
            USER: {
              text: '用户端',
              color: 'green'
            },
            // ENTERPRISE: {
            //   text: '企业端',
            //   color: 'blue'
            // }
          }
        }
      },
      {
        key: 'position',
        title: '位置',
        type: 'enum',
        config: {
          constants: {
            HOME_PAGE: {
              text: '首页',
              color: 'green'
            }
          }
        }
      },
      {
        key: 'sort',
        title: '排序',
        type: 'text',
      }
    ],

    actions: [
      {
        key: 'create',
        text: '添加搜索词条',
        icon: 'plus',
        type: 'form',
        permission: '/system/search-term/create',
        config: {
          color: 'primary',
          title: '添加搜索词条',
          initUrl: '/system/search-term/create/get',
          submitUrl: '/system/search-term/create',
          submitSuccessMessage: "添加成功",
          submitText: '确认添加',
          controls: [
            {
              key: 'content',
              label: '词条内容',
              type: 'text',
              required: true,
              config: {
                rules: [
                  {max: 20, message: '最多输入 20 个字符'}
                ]
              }
            },
            {
              key: 'isHot',
              label: '是否热门',
              type: 'radio',
              required: true,
              config: {
                options: [
                  {
                    text: '是',
                    value: true
                  },
                  {
                    text: '否',
                    value: false
                  }
                ]
              }
            },
            {
              key: 'portType',
              label: '端口类型',
              type: 'select',
              required: true,
              config: {
                options: [
                  {
                    text: '用户端',
                    value: 'USER'
                  },
                  // {
                  //   text: '企业端',
                  //   value: 'ENTERPRISE'
                  // }
                ]
              }
            },
            {
              key: 'position',
              label: '位置',
              type: 'select',
              required: true,
              config: {
                options: [
                  {
                    text: '首页',
                    value: 'HOME_PAGE'
                  }
                ]
              }
            },
            {
              key: 'isTop',
              label: '是否置顶',
              type: 'radio',
              required: true,
              config: {
                options: [
                  {
                    text: '是',
                    value: true
                  },
                  {
                    text: '否',
                    value: false
                  }
                ]
              }
            },
            {
              key: 'sort',
              label: '排序',
              type: 'numeric',
              required: true,
            }
          ]
        }
      }
    ],

    sorter: {
      sortableColumns: ['createdDate'],
      defaultSort: '-createdDate',
    },

    rowActions: [
      {
        key: 'edit',
        text: '修改',
        icon: 'plus',
        type: 'form',
        permission: '/system/search-term/edit',
        config: {
          color: 'primary',
          title: '修改搜索词条',
          initUrl: '/system/search-term/edit/get',
          submitUrl: '/system/search-term/edit',
          submitSuccessMessage: "修改成功",
          submitText: '确认修改',
          controls: [
            {
              key: 'content',
              label: '词条内容',
              type: 'text',
              required: true,
              config: {
                rules: [
                  {max: 20, message: '最多输入 20 个字符'}
                ]
              }
            },
            {
              key: 'isHot',
              label: '是否热门',
              type: 'radio',
              required: true,
              config: {
                options: [
                  {
                    text: '是',
                    value: true
                  },
                  {
                    text: '否',
                    value: false
                  }
                ]
              }
            },
            {
              key: 'isTop',
              label: '是否置顶',
              type: 'radio',
              required: true,
              config: {
                options: [
                  {
                    text: '是',
                    value: true
                  },
                  {
                    text: '否',
                    value: false
                  }
                ]
              }
            },
            {
              key: 'portType',
              label: '端口类型',
              type: 'select',
              required: true,
              config: {
                options: [
                  {
                    text: '用户端',
                    value: 'USER'
                  },
                  // {
                  //   text: '企业端',
                  //   value: 'ENTERPRISE'
                  // }
                ]
              }
            },
            {
              key: 'position',
              label: '位置',
              type: 'select',
              required: true,
              config: {
                options: [
                  {
                    text: '首页',
                    value: 'HOME_PAGE'
                  }
                ]
              }
            },
            {
              key: 'sort',
              label: '排序',
              type: 'numeric',
              required: true,
            }
          ]
        }
      }
    ]
  }
}
